﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using YBApproval.Model;

namespace YBApproval
{
    public class YBPSession
    {
        private YBPSession(){}

        public static YBPSession Instance
        {
            get
            {
                lock (HttpContext.Current.Session.SyncRoot)
                {
                    if (HttpContext.Current.Session["YBPSession"] == null)
                    {
                        HttpContext.Current.Session["YBPSession"] = new YBPSession();
                    }
                }
                return (YBPSession)HttpContext.Current.Session["YBPSession"];
            }
        }

        private UserProfile _CurrentUser;
        public UserProfile CurrentUser
        {
            get
            {
                //if (_CurrentUser == null) 
                //    return new UserProfile();
                //else
                return _CurrentUser;
            }
            set
            {
                _CurrentUser = value;
            }
        }

        private UserProfile _CurUserDeletage;
        public UserProfile CurUserDelegate
        {
            get
            {
                //if (_CurrentUser == null) 
                //    return new UserProfile();
                //else
                return _CurUserDeletage;
            }
            set
            {
                _CurUserDeletage = value;
            }
        }

        private List<Role> _MyRoleList;
        public List<Role> MyRoleList
        {
            get
            {
                return _MyRoleList;//tobe finish
            }
            set
            {
                _MyRoleList = value;
            }
        }

        private List<Role> _AllRolesList;
        public List<Role> AllRolesList
        {
            get
            {
                return _AllRolesList;//tobe finish
            }
            set
            {
                _AllRolesList = value;
            }
        }
    }
}